<template>
  <div class="pad-content-box form-no-padding-box">
    <div>
      <el-form label-width="100px" size="small" ref="searchForm" :model="searchParams">
        <el-row :gutter="50">
          <el-col :span="12">
            <el-form-item label="录入表数" prop="tableValue" :rules="[{ required: true, message: '请输入', trigger:['change','blur']}]">
              <el-input placeholder="请输入" v-model="searchParams.tableValue"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="剩余金额" prop="totalSurplusAmount" :rules="[{ required: true, message: '请输入', trigger:['change','blur']}]">
              <el-input placeholder="请输入" v-model="searchParams.totalSurplusAmount" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="抄表时间" prop="tableTime" :rules="[{ required: true, message: '请输入', trigger:['change','blur']}]">
              <el-date-picker 
                v-model="searchParams.tableTime" 
                type="datetime"
                value-format="timestamp"
                placeholder="请选择"> 
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="dialog-footer">
      <el-button @click="closeDialog({success:false})" size="small" class="el-button-reset">取 消</el-button>
      <el-button type="primary" size="small" @click="save()">确 定</el-button>
    </div>
  </div>
</template>

<script>
  import {entryNumber} from '../../../api/preCharge';
  export default {
    name: 'salesReport',
    props:{
      accountRechargeKey:{
        type:String,
        default:()=>{
          return null
        }
      }
    },
    data() {
      return {
        searchParams:{},
      };
    },
    created() {
    },
    methods: {
      async save() {
        this.$refs.searchForm.validate(async valid => {
          if (valid) {
            await entryNumber({...this.searchParams,accountRechargeKey:this.accountRechargeKey});
            this.closeDialog({success:true})
          }
        });
      },
      closeDialog(data){
        this.$emit('closeDialog',data)
        this.searchParams = {}
      }
    },
  };
</script>

<style lang="scss" scoped>
  ::v-deep .has-tab-header-border .el-tabs__header {
    border: none;
  }
  .dialog-footer{
    display: flex;
    justify-content: flex-end;
    margin-top:30px;
  }
</style>
